package com;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.report.doc.BaseDoc;
import com.report.doc.ExcelService;
import com.report.doc.WordService;
import com.report.exp.BaseExp;
import com.report.exp.RESID;
import com.schedule.domain.ResultRealtimeCollector;
import com.schedule.domain.Template;
import com.util.Utils;
import com.util.Word2Util;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.xmlbeans.XmlException;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import java.io.IOException;
import java.util.*;

/**
 *
 */
public class TestMain {



    public static void main(String[] args) throws Exception {

//        Word2Util word2PdfUtil = Word2Util.getInstance();
//
        //模板文件地址
        String inputUrl = "C:\\Users\\Administrator\\Desktop\\report\\demo\\001.docx";
//
//        // 解析模板内容
//        String s = word2PdfUtil.reeadWord(inputUrl);
//        System.out.println(s);
//
//        Template t = new Template();
//        t.setPath(inputUrl);
//
//        BaseDoc doc = new WordService();
//        doc.init(t);
//
//        System.out.println(doc);


//        String path = "C:\\Users\\Administrator\\Desktop\\report\\1\\template\\3201-002.xlsx";
//        Template t1 = new Template();
//        t1.setPath(path);
//
//        BaseDoc doc1 = ExcelService.getInstance(t1);
//        doc1.init();
//        doc1.create();



//        Set<String> set = new HashSet<String>();
//        set.add("123");
//        set.add("456");
//        List<String> setToList = new ArrayList<String>(set); //Set To List
//
//        System.out.println(setToList);

        ResultRealtimeCollector resultRealtimeCollector = new ResultRealtimeCollector();
        resultRealtimeCollector.setAdmin("aaa");
        String s = JSONObject.toJSON(resultRealtimeCollector).toString();
        Map<String, String> parse = ( Map<String, String>)JSONObject.parse(s);
        System.out.println(parse);


        Map<String, String> params = JSONObject.parseObject(s, new TypeReference<Map<String, String>>(){});
        System.out.println(params.get("admin"));






//        String ss = "@RESID_004497E44E493FFCF450A383F8D4F325,00CFD973891E551F48CBA8A48087ED51,0160FB3B3E3DE530E0FB769070C9C165,00CFD973891E551F48CBA8A48087ED51";
//
//        BaseExp exp = new RESID();
//        exp.init(ss);
//
//        System.out.println(ss.split(Constants.RESID));














        // 获取文档中的表达式
//        Map<String, Object> expData = word2PdfUtil.getExpData(inputUrl);



//        //新生产的模板文件
//        String outputUrl = "C:\\Users\\Administrator\\Desktop\\report\\demo\\test.docx";
//
//        Map<String, String> testMap = new HashMap<String, String>();
//        testMap.put("name", "小明");
//        testMap.put("sex", "男");
//        testMap.put("address", "软件园");
//        testMap.put("phone", "88888888");
//
//        List<String[]> testList = new ArrayList<String[]>();
//        testList.add(new String[]{"1","1AA","1BB","1CC","1CC","1CC"});
//        testList.add(new String[]{"2","2AA","2BB","2CC","1CC","1CC"});
//        testList.add(new String[]{"3","3AA","3BB","3CC","1CC","1CC"});
//        testList.add(new String[]{"4","4AA","4BB","4CC","1CC","1CC"});
//
//        word2PdfUtil.changWord(inputUrl, outputUrl, testMap, testList);



    }
}
